function ajaxLoad(categorie,module,data,callback,directURL){
	if(directURL == null) directURL = false;
	if(window.XMLHttpRequest) // Firefox 
		xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
		alert("init","Votre navigateur ne supporte pas les objets XMLHTTPRequest. Veuillez télécharger un navigateur plus récent");
		return; 
	}
	if(!directURL) xhr_object.open("POST", "index.php?categorie="+categorie+"&module="+module, true); 
	else xhr_object.open("POST", "modules/"+categorie+"/"+module+".php", true);
	xhr_object.onreadystatechange = function() { 
		if(xhr_object.readyState == 4) {
			return callback(xhr_object);
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send(data);
}

function ajaxGetIdData(id,prefix){
	if(!prefix) prefix = "";
	if(typeof(id) == "object"){
		data = "";
		for(var i = 0;i < id.length;i++){
			var node = document.getElementById(prefix+id[i]);
			data += (node.hasAttribute("value") || node.hasAttribute("rows"))? id[i]+'='+node.value+"&":id[i]+'='+node.innerHTML+"&";
		}
		data = data.substr(0,data.length - 1);
	}
	else
	{
		var node = document.getElementById(id);
		data = (node.hasAttribute("value"))? id+'='+node.value:id+'='+node.innerHTML;
	}
	return data;
}

function ajaxGetResult(xhr,id){
	if(id==null)id='ajaxResult';
	if(document.getElementById('temp')!=null)document.getElementById('temp').outerHTML = '';
	var div = document.createElement('div');div.setAttribute('style','display:none;');div.setAttribute('id','temp');
	div.innerHTML = xhr.responseText;
	document.body.appendChild(div);
	var result = document.getElementById(id);
	div.innerHTML = result.innerHTML;
	return result;
}

function appendErrorMessage(message,errDiv){
	if(errDiv==null)errDiv='errDiv';
	document.getElementById(errDiv).innerHTML = message;
}

function ajaxDump(obj) {
    var out = '';
    for (var i in obj) {
        out += i + ": " + obj[i] + "\n";
    }

    alert(out);
}